<template>
  <div class="app-container">
    <el-form ref="queryForm" :model="queryParams" :inline="true" label-width="68px">
      <el-form-item label="订单号" prop="orderId">
        <el-input
          v-model="queryParams.orderId"
          placeholder="请输入订单号"
          clearable
          size="small"
        />
      </el-form-item>
      <el-form-item label="购买人" prop="buyerName">
        <el-input
          v-model="queryParams.buyerName"
          placeholder="请输入购买人"
          clearable
          size="small"
        />
      </el-form-item>
      <el-form-item label="证件号" prop="orderId">
        <el-input
          v-model="queryParams.ConsigneeCode"
          placeholder="请输入购买人证件号"
          clearable
          size="small"
        />
      </el-form-item>
      <el-form-item label="所属商户" prop="merchant_name">
        <el-input
          v-model="queryParams.merchant_name"
          placeholder="请输入所属商户"
          clearable
          size="small"
        />
      </el-form-item>
      <el-form-item label="清单状态" prop="push_inventory">
        <el-select v-model="queryParams.pushInventory" filterable allow-create placeholder="清单状态" clearable size="small">
          <el-option
            v-for="(dict,index) in PushInventoryOptions"
            :key="index"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="订单时间" prop="orderDate">
        <el-date-picker
          v-model="queryParams.orderDate"
          size="small"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        />
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">

        <el-col :span="1.5">
          <el-button
            type="primary"
            plain
            icon="el-icon-upload2"
            size="mini"
            @click="exportOrder"
          >订单导出
          </el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="primary"
            plain
            icon="el-icon-upload2"
            size="mini"
            @click="exportOrderGoods"
          >订单商品导出
          </el-button>
        </el-col>

      </el-col>
    </el-row>

    <el-table v-loading="loading" :data="list" style="width: 100%;" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" />
      <el-table-column label="订单号" align="center" prop="orderId" />
      <el-table-column label="订单时间" align="center" prop="orderDate" width="150" />
      <el-table-column label="订购人" align="center" prop="buyerName" />
      <el-table-column label="订购人证件号" align="center" prop="ConsigneeCode" :show-overflow-tooltip="true" />
      <!--      <el-table-column label="交易流水号" align="center" prop="payOrderNo" />-->
      <el-table-column label="订单金额" align="center" prop="realPayment" />
      <el-table-column label="所属商户" align="center" prop="merchant_name" :show-overflow-tooltip="true" />
      <el-table-column label="清单状态" align="center" :formatter="statusFormat" />
      <el-table-column label="详情" align="center">
        <template v-slot="scope">
          <span style="color: #20a0ff;cursor:pointer" @click="see(scope.row)">查看</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
        <template v-slot="scope">
          <el-button
            v-action="'order@edit'"
            size="mini"
            type="primary"
            @click="edit(scope.row)"
          >修改
          </el-button>
          <el-button
            v-action="'order@delOrder'"
            size="mini"
            type="danger"
            @click="delOrder(scope.row)"
          >删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.page"
      :limit.sync="queryParams.limit"
      @pagination="getList"
    />

    <!-- 修改 -->
    <el-dialog title="编辑" :visible.sync="open" width="1200px" append-to-body>
      <el-form ref="formEdit" :model="form" label-position="left" label-width="130px">
        <el-divider content-position="center">基本信息</el-divider>
        <el-row>
          <el-col :span="8">
            <el-form-item label="电商订单号" prop="orderId">
              <el-input v-model="form.orderId" disabled maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="订单时间" prop="orderDate">
              <el-input v-model="form.orderDate" disabled maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item prop="realPayment">
              <span slot="label">
                实付款
                <el-tooltip content="商品价格+运杂费+代扣税款-非现金抵扣金额，与支付凭证 的支付金额一致" placement="top">
                  <i class="el-icon-info" />
                </el-tooltip>

              </span>
              <el-input v-model="form.realPayment" placeholder="请输入实付款金额" maxlength="50" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item prop="amount">
              <span slot="label">
                商品金额
                <el-tooltip content="商品实际成交价 FOB(不含运杂费)，含非现金抵扣金额" placement="top">
                  <i class="el-icon-info" />
                </el-tooltip>

              </span>
              <el-input v-model="form.amount" maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item prop="tax">
              <span slot="label">
                代扣税款
                <el-tooltip content="非现金抵扣金额（使用积分、虚拟货币、代金券等非现金支付金额，无则填写 “0”" placement="top">
                  <i class="el-icon-info" />
                </el-tooltip>

              </span>
              <el-input v-model="form.tax" maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item prop="distributionfee">
              <span slot="label">
                运杂费
                <el-tooltip content="无则填写“0”" placement="top">
                  <i class="el-icon-info" />
                </el-tooltip>

              </span>
              <el-input v-model="form.distributionfee" maxlength="50" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item prop="discount">
              <span slot="label">
                非现金抵扣
                <el-tooltip content="非现金抵扣金额（使用积分、虚拟货币、代金券等非现金支付金额，无则填写 “0”" placement="top">
                  <i class="el-icon-info" />
                </el-tooltip>

              </span>
              <el-input v-model="form.discount" maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="币制" prop="currency">
              <el-input v-model="form.currency" maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="支付交易编号" prop="payOrderNo">
              <el-input v-model="form.payOrderNo" maxlength="50" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="订购人" prop="buyerName">
              <el-input v-model="form.buyerName" maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="订购人证件号" prop="ConsigneeCode">
              <el-input v-model="form.ConsigneeCode" maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="收货人" prop="distributionfee">
              <el-input v-model="form.contactName" maxlength="50" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="收货人电话" prop="contactMobile">
              <el-input v-model="form.contactMobile" maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="收货地址" prop="contactAddr">
              <el-input v-model="form.contactAddr" maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="详细地址" prop="detailAddr">
              <el-input v-model="form.detailAddr" maxlength="50" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="邮政编码" prop="postcode">
              <el-input v-model="form.postcode" maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="备注" prop="note">
              <el-input v-model="form.note" maxlength="50" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-divider content-position="center">平台信息</el-divider>
        <el-row>
          <el-col :span="8">
            <el-form-item prop="ebpCode">
              <span slot="label">
                电商平台代码
                <el-tooltip content="电商平台的海关注册登记编号" placement="top">
                  <i class="el-icon-info" />
                </el-tooltip>

              </span>
              <el-input v-model="form.ebpCode" placeholder="请输入电商平台代码" maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="电商平台名称" prop="ebpName">
              <span slot="label">
                电商平台名称
                <el-tooltip content="电商平台的海关注册登记的平台名称" placement="top">
                  <i class="el-icon-info" />
                </el-tooltip>

              </span>
              <el-input v-model="form.ebpName" placeholder="请输入电商平台名称" maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item prop="paycomCode">
              <span slot="label">
                支付企业代码
                <el-tooltip content="支付企业的海关注册登记编号" placement="top">
                  <i class="el-icon-info" />
                </el-tooltip>

              </span>
              <el-input v-model="form.paycomCode" placeholder="请输入支付企业代码" maxlength="50" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item prop="paycomName">
              <span slot="label">
                支付企业名称
                <el-tooltip content="支付企业在海关注册登记的企业名称" placement="top">
                  <i class="el-icon-info" />
                </el-tooltip>

              </span>
              <el-input v-model="form.paycomName" placeholder="请输入支付企业名称" maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item prop="ebcCode">
              <span slot="label">
                电商企业代码
                <el-tooltip content="电商企业在海关注册登记的登记编号" placement="top">
                  <i class="el-icon-info" />
                </el-tooltip>

              </span>
              <el-input v-model="form.ebcCode" placeholder="请输入电商企业代码" maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item prop="ebcName">
              <span slot="label">
                电商企业代码
                <el-tooltip content="电商企业在海关注册登记的企业名称" placement="top">
                  <i class="el-icon-info" />
                </el-tooltip>

              </span>
              <el-input v-model="form.ebcName" placeholder="请输入电商企业名称" maxlength="50" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item prop="express_company">
              <span slot="label">
                快递公司
                <el-tooltip content="国内物流承运快递公司" placement="top">
                  <i class="el-icon-info" />
                </el-tooltip>

              </span>
              <el-input v-model="form.express_company" placeholder="请输入快递公司" maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item prop="express_no">
              <span slot="label">
                快递单号
                <el-tooltip content="国内物流承运的快递单号" placement="top">
                  <i class="el-icon-info" />
                </el-tooltip>

              </span>
              <el-input v-model="form.express_no" placeholder="请输入快递单号" maxlength="50" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item prop="bill_no">
              <span slot="label">
                运单号
                <el-tooltip content="国外物流承运的运单号" placement="top">
                  <i class="el-icon-info" />
                </el-tooltip>

              </span>
              <el-input v-model="form.bill_no" placeholder="请输入运单号" maxlength="50" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-divider content-position="center">商品信息</el-divider>
        <el-table :data="form.goodsListStr" border stripe style="width: 100%;">
          <el-table-column type="expand">
            <template slot-scope="scope">
              <el-form label-position="left" inline class="demo-table-expand">

                <el-form-item label="海关登记品名">
                  {{ scope.row.g_name }}
                </el-form-item>
                <el-form-item label="海关编码">
                  {{ scope.row.g_code }}
                </el-form-item>
                <el-form-item label="原产国(地区)编码">
                  {{ scope.row.origin_country_code }}
                </el-form-item>
                <el-form-item label="贸易国编号">
                  {{ scope.row.trade_country_code }}
                </el-form-item>
                <el-form-item label="规格型号">
                  {{ scope.row.g_model }}
                </el-form-item>
                <el-form-item label="币制">
                  {{ scope.row.currency_code }}
                </el-form-item>
                <el-form-item label="计量单位">
                  {{ scope.row.unit }}
                </el-form-item>
                <el-form-item>
                  <span slot="label">
                    计量数量
                    <el-tooltip content="商品数量*组合规格" placement="top">
                      <i class="el-icon-info" />
                    </el-tooltip>
                  </span>
                  {{ scope.row.num*scope.row.spec_qty }}
                </el-form-item>
                <el-form-item label="法定计量单位">
                  {{ scope.row.unit1 }}
                </el-form-item>
                <el-form-item label="法定计量数量">
                  {{ scope.row.qty1 }}
                </el-form-item>
                <el-form-item label="法定第二计量单位">
                  {{ scope.row.unit2 }}
                </el-form-item>
                <el-form-item label="法定第二计量数量">
                  {{ scope.row.qty2 }}
                </el-form-item>
                <el-form-item label="净重（KG）">
                  {{ scope.row.net_weight }}
                </el-form-item>
                <el-form-item label="毛重（KG）">
                  {{ scope.row.gross_weight }}
                </el-form-item>
              </el-form>
            </template>
          </el-table-column>
          <el-table-column prop="record_material_no" label="账册备案料号">
            <template slot-scope="scope">
              {{ scope.row.record_material_no }}
            </template>
          </el-table-column>
          <el-table-column prop="goods_name" label="电商平台品名">
            <template slot-scope="scope">
              <el-input v-model="scope.row.goods_name" :value="scope.row.goods_name" placeholder="电商平台品名" />
            </template>
          </el-table-column>
          <el-table-column prop="barcode" label="条形码">
            <template slot-scope="scope">
              <el-input v-model="scope.row.barcode" :value="scope.row.barcode" placeholder="条形码" />
            </template>
          </el-table-column>
          <el-table-column prop="num" label="商品数量">
            <template slot-scope="scope">
              <el-input v-model="scope.row.num" :value="scope.row.num" placeholder="数量" />
            </template>
          </el-table-column>
          <el-table-column prop="price" label="组合规格">
            <template slot-scope="scope">
              <el-input v-model="scope.row.spec_qty" :value="scope.row.spec_qty" placeholder="组合规格" />
            </template>
          </el-table-column>
          <el-table-column prop="price" label="单价">
            <template slot-scope="scope">
              <el-input v-model="scope.row.price" :value="scope.row.price" placeholder="单价" />
            </template>
          </el-table-column>
        </el-table>
        <el-row style="top: 30px;margin-bottom: 30px;text-align:center;">
          <el-col :span="24">
            <el-button type="primary" size="medium" @click="onSubmit">提 交</el-button>
            <el-button size="medium" @click="open = false">取 消</el-button>

          </el-col>
        </el-row>
      </el-form>
    </el-dialog>
    <!-- 物流导入 -->
    <el-dialog v-loading="export_loading" title="物流导入" :visible.sync="export_open" width="800px" append-to-body>
      <el-form ref="form" label-width="80px">
        <el-form-item label="模板下载">
          <el-button type="primary" size="mini" @click="downTemplate">点击下载</el-button>
        </el-form-item>
        <el-form-item label="上传文件">
          <el-upload
            ref="upload"
            class="upload-demo"
            :headers="importHeaders"
            :action="url.import"
            :on-success="handleSuccess"
            :on-change="handleImport"
            :file-list="fileList"
            :multiple="false"
            :auto-upload="false"
            :limit="1"
            accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
          >
            <el-button size="mini" type="success">选择文件</el-button>
            <div slot="tip" class="el-upload__tip">只能上传csv/xlsx/xls文件</div>
          </el-upload>
        </el-form-item>
        <el-row style="top: 30px;margin-bottom: 30px;text-align:center;">
          <el-col :span="24">
            <el-button type="primary" size="medium" @click="submitUpload">导 入</el-button>
            <el-button size="medium" @click="export_open = false">关 闭</el-button>

          </el-col>
        </el-row>
      </el-form>
    </el-dialog>
    <!-- 查看详情 -->
    <OrderDetails :show.sync="show" :form="form" />
  </div>
</template>
<style>
.el-col-8 .el-input__inner {
  width: 90%;
}

.demo-table-expand {
  font-size: 0;
}

.demo-table-expand label {
  width: 40%;
}

.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 50%;
}

.el-dialog:not(.is-fullscreen) {
  margin-top: 6vh !important;
  margin-bottom: 6vh !important;
}
</style>
<script>
import { joinList, orderInfo, delOrder, downTemplate, exportOrder, exportOrderGoods } from '@/api/order'
// eslint-disable-next-line no-unused-vars
import { mapGetters } from 'vuex'

export default {
  name: 'Index',
  data() {
    return {
      // 遮罩层
      loading: true,
      export_loading: false,
      // 总条数
      total: 0,
      // 表格数据
      list: [],
      ids: [], // 选中项
      multiple: true,
      // 是否显示弹出层
      open: false,
      export_open: false,
      fileList: [],
      url: {
        down: '',
        import: ''
      },
      dialogVisible: false,
      // 表单参数
      form: {},
      info: '',
      // 表单校验
      rules: {
        name: [
          { required: true, message: '名称不能为空', trigger: 'blur' }
        ]
      },
      // 订单状态
      PushOrderOptions: [
        { 'value': 0, 'label': '未推送' },
        { 'value': 1, 'label': '已推送' },
        { 'value': 2, 'label': '电子口岸申报中' },
        { 'value': 3, 'label': '发送海关成功' },
        { 'value': 4, 'label': '发送海关失败' },
        { 'value': 100, 'label': '海关退单' },
        { 'value': 120, 'label': '海关入库' }
      ],
      // 清单状态
      PushInventoryOptions: [
        { 'value': 0, 'label': '未推送' },
        { 'value': 1, 'label': '电子口岸已暂存' },
        { 'value': 2, 'label': '电子口岸申报中' },
        { 'value': 3, 'label': '发送海关成功' },
        { 'value': 4, 'label': '发送海关失败' },
        { 'value': 100, 'label': '海关退单' },
        { 'value': 120, 'label': '海关入库' },
        { 'value': 300, 'label': '人工审核' },
        { 'value': 399, 'label': '海关审结' },
        { 'value': 800, 'label': '放行' },
        { 'value': 899, 'label': '结关' },
        { 'value': 500, 'label': '查验' },
        { 'value': 501, 'label': '扣留移送通关' },
        { 'value': 502, 'label': '扣留移送缉私' },
        { 'value': 503, 'label': '扣留移送法规' },
        { 'value': 599, 'label': '其它扣留' },
        { 'value': 700, 'label': '退运' }
      ],
      // 贸易国
      tradeCountryData: [],
      currencyData: [],
      unitData: [],
      // 查询参数
      queryParams: {
        page: 1,
        limit: 10,
        orderId: undefined,
        ConsigneeCode: undefined,
        buyerName: undefined,
        // 日期范围
        orderDate: [],
        pushOrder: undefined
      },
      show: false,
      importAction: '',
      importHeaders: { authorization: 'Bearer ' + this.token },
      importList: [],
      extraImport: {},
      importLoading: false
    }
  },
  computed: {
    ...mapGetters([
      'token'
    ])
  },
  created() {
    // this.tradeCountryData = tradeCountryData // 贸易国编号
    // this.unitData = unitData // 计量单位
    // this.currencyData = currencyData // 币制代码
    this.getList()
  },
  methods: {
    /** 查询订单列表 */
    getList() {
      const that = this
      this.loading = true
      // console.log(this.queryParams)
      joinList(this.queryParams).then(response => {
        // console.log(response)
        if (response.code === 10000) {
          that.list = response.data
          that.total = response.count
        }
        that.loading = false
      })
    },
    /** 状态字典翻译 */
    valueToLabelFormat(value, list) {
      for (const d of list) {
        if (value === d.value) {
          value = d.label
          break
        }
      }
      return value
    },
    /** 导出订单列表 */
    exportOrder() {
      const that = this
      that.loading = true
      let params = {}
      // exportType 1:选中导出 2：列表导出
      if (that.ids.length > 0) {
        params.ids = that.ids.toString()
      } else {
        params = that.queryParams
      }

      exportOrder(params).then(response => {
        // console.log(response)
        if (response.code === 10000) {
          window.open(response.data.url)
        } else {
          that.$message.error(response.message)
        }
        that.loading = false
      })
    },
    /** 导出订单商品列表 */
    exportOrderGoods() {
      const that = this
      this.loading = true
      let params = {}
      // exportType 1:选中导出 2：列表导出
      if (that.ids.length > 0) {
        params.ids = that.ids.toString()
        params.exportType = 1
      } else {
        params = that.queryParams
        params.exportType = 2
      }
      exportOrderGoods(params).then(response => {
        // console.log(response)
        if (response.code === 10000) {
          window.open(response.data.url)
        } else {
          that.$message.error(response.message)
        }
        that.loading = false
      })
    },
    /** 查询订单详情 */
    see(row) {
      const that = this
      orderInfo({ orderId: row.orderId, type: 1 }).then(response => {
        that.form = response.data
        that.show = true
      })
    },
    /** 修改订单弹窗 */
    edit(row) {
      const that = this
      orderInfo({ orderId: row.orderId, type: 1 }).then(response => {
        that.form = response.data
        that.open = true
      })
    },
    /** 修改订单弹窗 */
    delOrder(row) {
      const that = this

      that.$confirm('是否删除订单' + row.orderId, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function() {
        delOrder({ orderId: row.orderId }).then(response => {
          that.$message.success(response.message)
          that.getList()
        })
      }).catch(() => {
      })
    },
    // 下载模板
    downTemplate() {
      const that = this
      downTemplate({ name: 'logistics' }).then(response => {
        // console.log(response)
        if (response.code === 10000) {
          window.open(response.data.url)
        } else {
          that.$message.error(response.message)
        }
      })
    },
    // 导入提交
    submitUpload() {
      this.$refs.upload.submit()
    },
    // 打开导入弹窗
    handleImport() {
      this.importHeaders.authorization = 'Bearer ' + this.token
      this.url.import = process.env.VUE_APP_BASE_API + '/order/importLogistics'
    },
    // 打开导入弹窗
    openImport() {
      this.export_open = true
      this.$refs.upload.clearFiles()
    },
    // 导入成功提示
    handleSuccess(response, file, fileList) {
      if (response.code === 10000) {
        this.$message.success(response.message)
        this.export_open = false
      } else {
        this.$message.error(response.message)
      }
    },
    /** 修改提交 */
    onSubmit() {
      const that = this
      orderInfo({ form: this.form, type: 2 }).then(response => {
        // console.log(response)
        if (response.code === 10000) {
          that.$message.success(response.message)
          that.open = false
          that.getList()
        } else {
          that.$message.error(response.message)
        }
      })
    },
    /** 状态字典翻译 */
    statusFormat(row, column) {
      let status = row.push_inventory
      for (const d of this.PushInventoryOptions) {
        if (row.push_inventory === d.value) {
          status = d.label
          break
        }
      }
      return status
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.page = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams = {
        page: 1,
        limit: 10,
        orderId: undefined,
        ConsigneeCode: undefined,
        buyerName: undefined,
        startTime: undefined,
        endTime: undefined,
        orderDate: []
      }
      this.handleQuery()
    },
    /** 提交时间改变 */
    datePick(value) {
      if (value) {
        this.queryParams.startTime = value[0]
        this.queryParams.endTime = value[1]
      } else {
        this.queryParams.startTime = undefined
        this.queryParams.endTime = undefined
      }
    },

    /** 选中的项 */
    handleSelectionChange(val) {
      this.ids = val.map(item => item.orderId)
      this.multiple = !val.length
    }
  }
}
</script>
